﻿using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Documents;

namespace DA.Core.Common
{
    public class MessageManager:IMessage
    {
        private static readonly log4net.ILog log = log4net.LogManager.GetLogger("log");
        public BlockingCollection<MessageBody> MessageBlocks { get; set; }
        private readonly CancellationToken ct;
        public MessageManager()
        {
            ct = new CancellationTokenSource().Token;
            MessageBlocks = new BlockingCollection<MessageBody>();
        }
        
        public void LogInfo()
        {
        }

        public void Push(MessageBody body)
        {
            MessageBlocks.Add(body);
        }
    }
    public enum MessageType
    {
        Info,
        Error,
        Warning,
    }
    public class MessageBody
    {
        public string Source { get; set; }
        public MessageType Type { get; set; }
        public object Message { get; set; }
        public DateTime Time { get; set; }
    }
}
